/*
 * Copyright 2007 Eloff Enterprises
 *
 * Licensed under the BSD License (the "License").
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://rwig.googlecode.com/files/LICENSE
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.  See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * Originally developed by Daniel Eloff.
 *
 */

#ifndef rwig_utils_h
#define rwig_utils_h

#include <Python.h>
#include <memory.h>

typedef struct {
	char * buf;
	int len;
} rwig_str;

extern rwig_str RWIG_STR_NULL;

int py_to_int(PyObject * obj);
float py_to_float(PyObject * obj);
double py_to_double(PyObject * obj);
char * py_to_str(PyObject * obj);
rwig_str py_to_rwig_str(PyObject * obj);

#define rwig_free(str) free((str)->buf)

#endif